﻿//ZBRUSH MACRO - Recorded in ZBrush version 4.7 WORKS
[RoutineDef,cyclepaint,
[IPress,Tool:Polygroups:From Polypaint]
[IPress,Tool:Polypaint:Polypaint From Polygroups]
]//end routine

[IButton,???,"Cycle Paint Choice, Loads of fun, Yes for All, No for one",
[IShowActions,0]
[IConfig,4.7]
[VarSet,choice,[MessageYesNo,"Run on one or all? Yes for all, No for just one","Do you wish to run the script?"]]//this worked
[If,choice=1,

//[IFreeze,
  [If,[IExists,Tool:SubTool:SelectDown],
   //store active subtool
   [VarSet,activeSubTool,[SubToolGetActiveIndex]]
   //loop through all subtools
   [Loop,[SubToolGetCount],	
    [SubToolSelect,[Var,n]]	   
     [RoutineCall,cyclepaint] //calls the routine for what we want to do      	
   ,n]//end loop
   //reselect active subtool
    [SubToolSelect,activeSubTool]
	]//end if,
	//]//end freeze
//[IPress,Transform:Xpose]
//[IPress,Transform:Fit]
,
[RoutineCall,cyclepaint]
//[IPress,Transform:Fit]
]//end if
]//end of macro button
